/*==============================================================================
             Copyright (c) 2009 - All rights reserved
================================================================================
File description:

    Graphics platform function definition

================================================================================
      Date            Name                    Description of Change
24-Aug-2009  Xiaofeng.Gu                    Written
$HISTORY$
==============================================================================*/
#include "stdafx.h"
#include "GraphicsPlatform.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#endif

CGraphicsPlatform::CGraphicsPlatform()
: m_pDC(NULL),
  m_pGraphPlotter(NULL)
{
	m_pGViewer = new CGViewer(this);
}

CGraphicsPlatform::~CGraphicsPlatform()
{
	delete m_pGViewer;
	m_pGViewer = NULL;
}

void CGraphicsPlatform::Fit(IGraphics* pGraphics)
{
	CGBox box = (pGraphics)->GetRangeBox();
	m_pGViewer->Fit(box);
}

void CGraphicsPlatform::OnSize(int cx, int cy)
{
	CCoordinateSystemGraphics* pCSGraphics = m_pGViewer->GetCSGraphics();
	if (pCSGraphics->IsInit())
	{
		pCSGraphics->InitializeByPixel(pCSGraphics->GetPixelLength());
	}
}
